<template>
	<view class="page flex-col align-center">
		<view class="group_1 flex-col">
			<view class="box_2 flex-col">
				<image class="image_2" referrerpolicy="no-referrer" src="https://siha.vxmeng.com/static/login/logo.png" />

				<div class="text-wrapper_2 flex-col">
					<input type="text" :placeholder="$t('login.qsrsjh')" v-model="mobile"/>
				</div>
				<view class="box_11 flex-row justify-between">
					<div class="text-wrapper_2 flex-col">
						<input type="text" :placeholder="$t('login.qsryzm')" v-model="captcha"/>
					</div>
					<text class="text_4" @click="sendCaptcha">{{$t('login.fsyzm')}}</text>
				</view>
				<!-- 				<div class="text-wrapper_2 flex-col">
					<input type="text" :placeholder="$t('login.yqm(xt)')" />
				</div> -->
				<view class="box_18 flex-row justify-between">
					<view class="block_1 flex-col">
						<view class="group_2 flex-col">
							<div class="box_3 flex-col"></div>
							<radio-group name="">
								<label>
									<radio :value="'1'" :checked="agree === '1'" @click="radioChange"/>
								</label>
							</radio-group>
						</view>
					</view>
					<text class="text_4" @click="comLink('/pages/my/text?tit=隐私协议')">
						{{$t('login.yydbty')}}
					</text>
				</view>
				<view class="btn" @click="codeLogin">
					<text>{{$t('login.dl')}}</text>
				</view>
				<view class="box_19 flex-row justify-center">
					<text class="text_6" @click="comLink('/pages/login/passLogin')">{{$t('login.mmdl')}}</text>
				</view>
<!-- 				<view class="box_20 flex-row justify-between" @click="$tools.toTabs('/pages/index/index')">
					<view class="image-wrapper_1 flex-col">
						<image class="label_1" referrerpolicy="no-referrer"
							src="https://siha.vxmeng.com/static/login/icon-weixin.png" />
					</view>
					<view class="image-wrapper_2 flex-col">
						<image class="label_2" referrerpolicy="no-referrer"
							src="https://siha.vxmeng.com/static/login/icon-qq.png" />
					</view>
					<view class="image-wrapper_3 flex-col">
						<image class="label_3" referrerpolicy="no-referrer"
							src="https://siha.vxmeng.com/static/login/icon-apple.png" />
					</view>
				</view> -->
			</view>
			<view class="group_13 flex-col">
				<text class="paragraph_1">
					{{$t('login.version')}}
				</text>
				<text class="paragraph_1">
					{{$t('login.xyhzdzc')}}
				</text>
				<div class="section_4 flex-col"></div>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				constants: {},
				agree: '0',
				mobile: '',
				captcha: '',
			};
		},
		onReady() {
			this.$music.bgmInstance.stop();
		},
		methods: {
			radioChange(){
				this.agree = this.agree === '1' ? '0' : '1'
				console.log(this.agree);
			},
			async sendCaptcha() {
				const reg = /^1[3-9]\d{9}$/;
				if (!reg.test(this.mobile)) {
					this.$music.play_error()
					this.$tools.showTx(this.$t('grzx.qsrzqdsjh'))
				} else {
					const res = await this.$myRequest({
						url: 'api/sms/send',
						data: {
							mobile: this.mobile,
							event: 'mobilelogin',
						}
					});
					console.log(res);
					if(res.code == 1){
						this.isSend = true;
						this.$tools.showTx(res.msg)
					}
				}
			},
			async codeLogin(){
				if(!this.isSend) return;
				if(this.agree == '0') {
					this.$music.play_error()
					this.$tools.showTx(this.$t('login.qxydbgx'))
					return
				}
				const res = await this.$myRequest({
					url: 'api/user/mobilelogin',
					data: {
						mobile: this.mobile,
						captcha: this.captcha,
					}
				});
				if (res.code == 1) {
					console.log(res)
					this.$music.bgmInstance.play()
					uni.setStorageSync('token', res.data.userinfo.token)
					// #ifdef H5
					
					this.messageFun('token',res.data.userinfo.token)
					// #endif
					this.$websocetObj.sokcet()
					this.$tools.showTx(res.msg)
					setTimeout(()=>{
						this.$tools.toTabs('/pages/index/index')
					},1000)
				}
			},
		},
	};
</script>
<style lang="less" scoped>
	.page {
		position: relative;
		width: 750rpx;
		height: 100vh;
		overflow: hidden;
    background: url(https://siha.vxmeng.com/static/index/bg.png) no-repeat center;
    background-size: 120% 100%;

		.group_1 {
			background-image: linear-gradient(180deg,
					rgba(49, 49, 49, 1) 0,
					rgba(59, 59, 59, 0) 13.571429%,
					rgba(36, 36, 36, 0) 80.000001%,
					rgba(27, 27, 27, 1) 100%);
			width: 750rpx;
			height: 100vh;

			display: flex;
			align-items: center;
			justify-content: center;

			.box_1 {
				width: 750rpx;
				height: 88rpx;

				.text_1 {
					width: 108rpx;
					height: 54rpx;
					overflow-wrap: break-word;
					color: rgba(216, 216, 216, 1);
					font-size: 40rpx;
					font-family: SegoeUI-Regular;
					font-weight: normal;
					text-align: center;
					white-space: nowrap;
					line-height: 54rpx;
					margin: 28rpx 0 0 40rpx;
				}

				.thumbnail_1 {
					width: 34rpx;
					height: 22rpx;
					margin: 34rpx 0 0 438rpx;
				}

				.thumbnail_2 {
					width: 32rpx;
					height: 24rpx;
					margin: 34rpx 0 0 10rpx;
				}

				.image_1 {
					width: 50rpx;
					height: 24rpx;
					margin: 34rpx 28rpx 0 10rpx;
				}
			}

			.box_2 {
				width: 630rpx;
				// height: 752rpx;
				/* 弹窗/半透明 */
				background: linear-gradient(141deg, rgba(0, 0, 0, 0.5647) 0%, rgba(0, 0, 0, 0.6126) 98%, rgba(30, 36, 44, 0.65) 98%);

				/* 弹窗/投影 */
				box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.3);
				border-radius: 20rpx;
				padding-bottom: 50rpx;
				// margin: 348rpx 0 0 62rpx;

				.image_2 {
					width: 128rpx;
					height: 128rpx;
					margin: 46rpx 0 0 250rpx;
				}

				.text-wrapper_1 {
					height: 80rpx;
					background: linear-gradient(90deg, #62B6FC 0%, #5F58FD 100%);
					border-radius: 60rpx;
					width: 550rpx;
					margin: 54rpx 0 0 40rpx;

					.text_2 {
						width: 256rpx;
						height: 46rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 32rpx;
						font-family: Source Han Sans-Regular;
						font-weight: normal;
						text-align: center;
						white-space: nowrap;
						line-height: 46rpx;
						margin: 18rpx 0 0 148rpx;
					}
				}

				.box_11 {
					width: 550rpx;
					height: 80rpx;
					margin: 26rpx 0 0 40rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.text-wrapper_2 {
						height: 80rpx;
						background: rgba(#000000, 0.8);
						border-radius: 60rpx;
						width: 350rpx !important;
						margin: 0 !important;
					}

					.text_4 {
						width: 160rpx;
						// height: 46rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 32rpx;
						font-family: Source Han Sans-Regular;
						border-bottom: 2rpx solid rgba(216, 216, 216, 1);
						font-weight: normal;
						text-align: left;
						// white-space: nowrap;
						line-height: 46rpx;
					}
				}

				.text-wrapper_2 {
					height: 80rpx;
					background: rgba(#000000, 0.8);
					border-radius: 60rpx;
					width: 550rpx;
					margin: 26rpx 0 0 40rpx;

					input {
						width: 100%;
						height: 40rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 28rpx;
						font-family: Source Han Sans-Regular;
						font-weight: normal;
						text-align: left;
						white-space: nowrap;
						padding-left: 30rpx;
						box-sizing: border-box;
						line-height: 40rpx;
						margin: 18rpx 0 0 0;
					}
				}

				.box_18 {
					width: 542rpx;
					// height: 68rpx;
					margin: 24rpx 0 0 40rpx;

					.block_1 {
						height: 28rpx;
						margin-top: 6rpx;
						width: 28rpx;

						.group_2 {
							height: 28rpx;
							width: 28rpx;
							position: relative;

							.box_3 {
								width: 22rpx;
								height: 22rpx;
								margin: 4rpx 0 0 4rpx;
							}

							.thumbnail_3 {
								position: absolute;
								left: 0;
								top: 0;
								width: 28rpx;
								height: 28rpx;
							}
						}
					}

					.text_4 {
						width: 504rpx;
						// height: 68rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 24rpx;
						font-family: Source Han Sans-Regular;
						font-weight: normal;
						text-align: left;
						line-height: 34rpx;
						margin-left: 25rpx;
					}
				}

				.btn {
					width: 550rpx;
					height: 80rpx;
					margin: 36rpx 0 0 40rpx;
					background: linear-gradient(90deg, #62B6FC 0%, #5F58FD 100%);
					border-radius: 60rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 32rpx;
					color: #D8D8D8;
				}

				.box_19 {
					width: 358rpx;
					height: 36rpx;
					margin: 36rpx 0 0 136rpx;

					.text_5 {
						width: 120rpx;
						height: 34rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 24rpx;
						font-family: Source Han Sans-Regular;
						border-bottom: 2rpx solid rgba(216, 216, 216, 1);
						font-weight: normal;
						text-align: left;
						white-space: nowrap;
						line-height: 34rpx;
					}

					.box_4 {
						width: 2rpx;
						height: 28rpx;
						border: 1px solid rgba(216, 216, 216, 1);
						margin: 8rpx 0 0 70rpx;
					}

					.text_6 {
						// width: 96rpx;
						height: 34rpx;
						overflow-wrap: break-word;
						color: rgba(216, 216, 216, 1);
						font-size: 24rpx;
						font-family: Source Han Sans-Regular;
						border-bottom: 2rpx solid rgba(216, 216, 216, 1);
						font-weight: normal;
						text-align: left;
						white-space: nowrap;
						line-height: 34rpx;
					}
				}

				.box_20 {
					width: 344rpx;
					height: 72rpx;
					margin: 44rpx 0 58rpx 144rpx;

					.image-wrapper_1 {
						background-color: rgba(216, 216, 216, 0.4);
						border-radius: 50%;
						height: 72rpx;
						width: 72rpx;

						.label_1 {
							width: 72rpx;
							height: 72rpx;
						}
					}

					.image-wrapper_2 {
						background-color: rgba(216, 216, 216, 0.4);
						border-radius: 50%;
						height: 72rpx;
						margin-left: 64rpx;
						width: 72rpx;

						.label_2 {
							width: 72rpx;
							height: 72rpx;
						}
					}

					.image-wrapper_3 {
						background-color: rgba(216, 216, 216, 0.4);
						border-radius: 50%;
						height: 72rpx;
						margin-left: 64rpx;
						width: 72rpx;

						.label_3 {
							width: 72rpx;
							height: 72rpx;
						}
					}
				}
			}

			.group_13 {
				width: 750rpx;
				// height: 438rpx;
				margin-bottom: 2rpx;
				display: flex;
				align-items: center;
				flex-direction: column;
				justify-content: center;
				position: fixed;
				bottom: 50rpx;

				.paragraph_1 {
					// width: 400rpx;
					// height: 68rpx;
					overflow-wrap: break-word;
					color: rgba(162, 162, 162, 1);
					font-size: 24rpx;
					font-family: Source Han Sans-Regular;
					font-weight: normal;
					text-align: center;
					line-height: 34rpx;
					// margin: 284rpx 0 0 184rpx;
				}

				.section_4 {
					width: 246rpx;
					height: 10rpx;
					// margin: 56rpx 0 20rpx 254rpx;
				}
			}
		}
	}
</style>